package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();
        Integer value = map.put("语文",99);
        System.out.println(value);
        map.put("数学",99);
        map.put("英语",94);
        map.put("物理",93);
        map.put("化学",95);
        System.out.println(map);

        map.put("数学", 70);//将数学原有的98替换并返回
        System.out.println(map);
        System.out.println(map.put("数学", 70));

        System.out.println(map.get("英语"));
        System.out.println(map.get("体育"));

        int size = map.size();
        System.out.println(size);

        map.remove("化学");
        System.out.println(map);

//        map.clear();  //清空元素
//        System.out.println(map);
        boolean key = map.containsKey("语文");
        boolean value1 = map.containsValue(99);
        System.out.println(key+","+value1);

    }
}
